package com.wujian.love.controller;

import cn.hutool.core.date.DateUtil;
import com.wujian.love.dto.LoginDto;
import com.wujian.love.result.JSONResult;
import com.wujian.love.utils.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;


/**
 * @ClassName: LoginController
 * @Description: 登录
 * @Author: wuj
 * @Date: 2020-12-31 10:11
 **/
@RequestMapping("/login")
@RestController
public class LoginController {

    private static final Logger logger = LoggerFactory.getLogger(LoginController.class);

    @PostMapping("do_login")
    public JSONResult login(@Valid LoginDto dto, HttpServletRequest request){
        logger.info("用户【{}】在【{}】于【{}】登录",dto.getUserName(), CommonUtils.getIpAddr(request), DateUtil.now());
        return JSONResult.ok();

    }




}
